package com.cykj.pos.service.impl;

import com.cykj.common.annotation.DataSource;
import com.cykj.common.enums.DataSourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.cykj.pos.mapper.BizPosTypeMapper;
import com.cykj.pos.domain.BizPosType;
import com.cykj.pos.service.IBizPosTypeService;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * POS机类型Service业务层处理
 *
 * @author weijianbo
 * @date 2021-05-18
 */
@Service
public class BizPosTypeServiceImpl extends ServiceImpl<BizPosTypeMapper, BizPosType> implements IBizPosTypeService {
    @Resource
    BizPosTypeMapper bizPosTypeMapper;
    @Override
    public List<BizPosType> queryList(BizPosType bizPosType) {
        List<BizPosType> list=bizPosTypeMapper.queryList(bizPosType);
        return list;
    }
    public List<BizPosType> selposType() {
        List<BizPosType> list=bizPosTypeMapper.selposType();
        return list;
    }
    public List<BizPosType> selpostaxation() {
        List<BizPosType> list=bizPosTypeMapper.selpostaxation();
        return list;
    }

    @DataSource(DataSourceType.SLAVE)
    @Override
    public BizPosType getPosTypeById(Long id) {
        LambdaQueryWrapper<BizPosType> posQuery = Wrappers.lambdaQuery();
        posQuery.eq(BizPosType::getId ,id);
        return this.getOne(posQuery);
    }

}
